import type {BasicColumn, FormSchema} from '@/components/Table'
import {useRender} from '@/components/Table'

export const columns: BasicColumn[] = [
  {
    title: '交易日期',
    dataIndex: 'tradeDate',
    width: 160,
    customRender: ({ text }) => {
      return useRender.renderDate(text)
    }
  },
  {
    title: '期初接受的现金形式客户备付金余额',
    dataIndex: 'g01',
    width: 160
  },
  {
    title: '本期接受现金形式的客户备付金金额',
    dataIndex: 'g02',
    width: 160
  },
  {
    title: '本期向备付金银行缴存的现金备付金',
    dataIndex: 'g03',
    width: 160
  },
  {
    title: '期末现金形式的客户备付金余额',
    dataIndex: 'g04',
    width: 160
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 180,
    customRender: ({ text }) => {
      return useRender.renderDate(text)
    }
  },
]

export const searchFormSchema: FormSchema[] = [
  {
    label: '交易日期',
    field: 'tradeDate',
    component: 'RangePicker',
    colProps: { span: 8 }
  },
]

export const createFormSchema: FormSchema[] = [
  {
    label: '编号',
    field: 'id',
    show: false,
    component: 'Input'
  },
  {
    label: '交易日期',
    field: 'tradeDate',
    component: 'DatePicker',
    required: true,
    labelWidth: 400,
    componentProps: {
      showTime: false,
      format: 'YYYY-MM-DD',
      valueFormat: 'x',
    }
  },
  {
    label: '期初接受的现金形式客户备付金余额',
    field: 'g01',
    required: true,
    labelWidth: 400,
    component: 'InputNumber',
    defaultValue: 0
  },
  {
    label: '本期接受现金形式的客户备付金金额',
    field: 'g02',
    required: true,
    labelWidth: 400,
    component: 'InputNumber',
    defaultValue: 0
  },
  {
    label: '本期向备付金银行缴存的现金备付金',
    field: 'g03',
    required: true,
    labelWidth: 400,
    component: 'InputNumber',
    defaultValue: 0
  },
  {
    label: '期末现金形式的客户备付金余额',
    field: 'g04',
    required: true,
    labelWidth: 400,
    component: 'InputNumber',
    defaultValue: 0
  },
]

export const updateFormSchema: FormSchema[] = [
  {
    label: '编号',
    field: 'id',
    show: false,
    component: 'Input'
  },
  {
    label: '交易日期',
    field: 'tradeDate',
    component: 'DatePicker',
    required: true,
    labelWidth: 400,
    componentProps: {
      showTime: false,
      format: 'YYYY-MM-DD',
      valueFormat: 'x',
    }
  },
  {
    label: '期初接受的现金形式客户备付金余额（g01）',
    field: 'g01',
    required: true,
    labelWidth: 400,
    component: 'InputNumber'
  },
  {
    label: '本期接受现金形式的客户备付金金额（g02）',
    field: 'g02',
    required: true,
    labelWidth: 400,
    component: 'InputNumber'
  },
  {
    label: '本期向备付金银行缴存的现金备付金（g03）',
    field: 'g03',
    required: true,
    labelWidth: 400,
    component: 'InputNumber'
  },
  {
    label: '期末现金形式的客户备付金余额（g04）',
    field: 'g04',
    required: true,
    labelWidth: 400,
    component: 'InputNumber'
  },
]
